import java.io.UnsupportedEncodingException;

public class CharsetDemo {
	public static void main(String[] args) {
		String s = "abc";
		try {
			byte ascii[] = s.getBytes("ascii");
			System.out.println(new String(ascii, "gbk"));
			System.out.println(new String(ascii, "utf-8"));
			
			s = "(CMD,ITV,22,1,012200";
			System.out.println(s.substring(12, 13));
			System.out.println(s.substring(14, 16));
			
			s = "0x00000900";
			System.out.println(Integer.valueOf(s.substring(2),16));
			
			s = " 40 40 00 40 00 a2 4d 63 45 00 00 51 43 00 08 01 02 01 06 02 01 02 03 04 00 00 00 00 04 04 00 00 ff 00 05 02 00 64 06 04 00 00 00 11 07 02 00 64 08 02 00 64 09 01 0f 0a 02 02 d5 0b 01 03 0c 01 1e 0d 01 02 5c 74";
			s = s.replaceAll(" ", "");
			System.out.println(s);
			System.out.println(s.length());
			
			System.out.println(Short.MAX_VALUE);
			short sh = -32766;
			System.out.println((short)(sh&0xFFFF));
			System.out.println(0x8002);
			System.out.println(0x8202);
			s = "M621500000031";
			System.out.println(s.substring(0, 1));
			System.out.println(s.substring(1, 13));
		} catch (UnsupportedEncodingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
